package com.movie.dao.impl;

import java.util.List;
import java.util.Map;

import com.movie.comm.utils.MD5;
import com.movie.comm.utils.PageData;
import com.movie.dao.AdminDao;
import com.movie.db.util.DBHelper;

public class AdminDaoImpl implements AdminDao {

	private DBHelper dbHelper=null;
	
	
	
	public AdminDaoImpl() {
		dbHelper = new DBHelper();
	}



	@Override
	public boolean adminLogin(PageData data) {
		String sql = "select * from admin where username = ? and password = ?";
		//需要对密码进行md5编码
		if(null == data.get("username")||null==data.get("password"))
		{
			return false;
		}
		Object [] params ={data.get("username"),MD5.md5(data.getString("password"))};
		List<Map<String, Object>> list = dbHelper.getSimpleObjs(sql, params);
		if(list.size()==0)
			return false;
		return true;
	}

}
